package com.guigu.liuyunan.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.liuyunan.mapper.CheckitemMapper;
import com.guigu.liuyunan.pojo.Checkitem;
import com.guigu.liuyunan.pojo.LYNPageVo;
import com.guigu.liuyunan.service.CheckitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CheckitemServiceImpl implements CheckitemService {

    @Autowired
    CheckitemMapper checkitemMapper;

    @Override
    public PageInfo checkitemInfo(LYNPageVo LYNPageVo) {
        PageHelper.startPage(LYNPageVo.getPage(), LYNPageVo.getNum());
        List<Checkitem> checkitems = checkitemMapper.checkitemInfo(LYNPageVo);
        return new PageInfo(checkitems);
    }

    @Override
    public int addCheckItem(Checkitem checkitem) {
        return checkitemMapper.insert(checkitem);
    }

    @Override
    public int delCheckItem(Integer id) {
        return checkitemMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int UpCheckItem(Checkitem checkitem) {
        return checkitemMapper.updateByPrimaryKeySelective(checkitem);
    }
}
